import base64

def Decrypt():
    try:
        seed = input('输入种子文件路径：')
        seedfiles = open(seed, 'rb')
    except:
        print('【文件打开失败！】')
    decode1 = base64.b16decode(seedfiles.read())
    decode2 = base64.b16decode(decode1)
    seedfiles.close()
    # try:
    name = seed.split(sep='.')
    try:
        fn = name[0]
        meta = name[1]
        fn2 = fn + '.' + meta
    except:
        print('【出现问题】')
    output = open(fn2, 'wb')
    output.write(decode2)
    output.close()
    print('【解密成功！】')
def Encrypt():
    try:
        files = input('请输入路径：')
        binary = open(files, 'rb')
    except:
        print('【文件打开失败！】')
    encrypt = base64.b16encode(binary.read())
    encrypt2 = base64.b16encode(encrypt)
    seed = open(files + '.encpt', 'wb')
    seed.write(encrypt2)
    binary.close()
    seed.close()
    print('【加密成功！】')


print('=========================================\n')
print('                加密传送工具 1.0          \n')
print('=========================================\n')
print('                 1.加密为种子           \n')
print('                 2.还原为文件           \n')
print('=========================================\n')
choice=input('请选择，如果按其它键表示退出程序:')
if choice=='1':
    Encrypt()
elif choice=='2':
    Decrypt()
